using System;
using System.Data.Linq;
using System.Linq;
using Magiq.Support;

namespace Magiq.Sql {
  public static class DataContextExtension {
    public static DataContext DataContext(this IQueryable self) {
      return self.Field<DataContext>("context");
    }

    public static string TableNameFor(this DataContext self, Type mappedType) {
      return "[" + self.Mapping.GetMetaType(mappedType).Table.TableName + "]";
    }
  }
}